package com.java.excend.exer_1;

/**
 * @author luzhikun
 * @date 2020/12/5- 17:22
 */
class Account {
    private int id;
    private double balance;
    private double annuallnterestRate;

    public Account() {

    }

    public Account(int id, double balance, double annuallnterestRate) {
        this.id = id;
        this.balance = balance;
        this.annuallnterestRate = annuallnterestRate;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getBalance() {
        return balance;
    }

    public void setAnnuallnterestRate(double annuallnterestRate) {
        this.annuallnterestRate = annuallnterestRate;
    }

    public double getAnnuallnterestRate() {
        return annuallnterestRate;

    }

    //获取月平均输入
    public double getMonthlyInterest() {
        return annuallnterestRate / 12;
    }

    //取钱
    public void withdraw(double amount) {
        if (balance < amount) {
            System.out.println("你的余额不足");
        } else {
            balance -= amount;
            System.out.println("你取的金额为：" + amount + "您的余额为：" + balance);
            return;
        }
    }

    //存钱
    public void deposit(double amount) {
        if (amount <= 0) {
            System.out.println("您的输入有误，请重新输入");
        } else {
            balance += amount;
            System.out.println("你本次存钱金额为：" + amount + "  您的余额为:" + balance + "  年利率为：" + getMonthlyInterest());
        }

    }

    public int getMax(int a, int b) {
        int c = a + b;
        return c;
    }

}
